{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd \n",
    "import matplotlib.pyplot as plt\n",
    "import tushare as ts"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#获取平安银行的历史数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = ts.get_k_data('601318',start='1988-01-01')\n",
    "df.to_csv('601318.csv')\n",
    "df = pd.read_csv('601318.csv', index_col='date' ,parse_dates=['date'])[['open','close']]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#计算5日均线和30日均线"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "df['ma5'] = np.nan\n",
    "df['ma30'] = np.nan"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"rolling函数\\ndf['ma5'] = df['close'].rolling(5).mean\\ndf['ma30'] = df['close'].rolling(30).mean\\n\""
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#for循环计算\n",
    "for i in range(4,len(df)):\n",
    "    df.loc[df.index[i],'ma5']=df['close'][i-4:i+1].mean()\n",
    "\n",
    "for i in range(29,len(df)):\n",
    "    df.loc[df.index[i],'ma30']=df['close'][i-29:i+1].mean()\n",
    "\n",
    "'''rolling函数\n",
    "df['ma5'] = df['close'].rolling(5).mean\n",
    "df['ma30'] = df['close'].rolling(30).mean\n",
    "'''"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAEACAYAAACj0I2EAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAD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0boGRb8FjgJfAH8AT+VtB4BhSRMRcQNptfkTwD2k6VFfBdaR5r/eIWlb7SHMeuSCbmZWCHe5mJkVwgXdzKwQLuhmZoVwQTczK4QLuplZIVzQzcwK4YJuZlYIF3Qzs0L8BcI9PkthV0y6AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#用matplot包画出均线\n",
    "df[['ma5','ma30','close']].plot()\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"#循环求解\\nfor i in range(1,len(df)):\\n    if df['ma5'][i] >= df['ma30'][i] and df['ma5'][i-1] < df['ma30'][i-1]:\\n        golden_cross.append(df.index[i])\\n    if df['ma5'][i] <= df['ma30'][i] and df['ma5'][i-1] > df['ma30'][i-1]:\\n        death_cross.append(df.index[i])  \\n\""
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#分别算出金叉日期和死叉日期\n",
    "df = df.dropna() #去掉缺省值\n",
    "df = df['2010-01-01':]\n",
    "\n",
    "golden_cross = []\n",
    "death_cross = []\n",
    "\n",
    "'''#循环求解\n",
    "for i in range(1,len(df)):\n",
    "    if df['ma5'][i] >= df['ma30'][i] and df['ma5'][i-1] < df['ma30'][i-1]:\n",
    "        golden_cross.append(df.index[i])\n",
    "    if df['ma5'][i] <= df['ma30'][i] and df['ma5'][i-1] > df['ma30'][i-1]:\n",
    "        death_cross.append(df.index[i])  \n",
    "'''"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DatetimeIndex(['2010-03-22', '2010-06-23', '2010-12-09', '2011-02-18',\n",
       "               '2011-03-04', '2011-04-06', '2011-06-30', '2011-10-28',\n",
       "               '2012-01-13', '2012-04-17', '2012-06-13', '2012-09-13',\n",
       "               '2012-09-27', '2012-12-07', '2013-04-22', '2013-05-09',\n",
       "               '2013-08-14', '2013-10-14', '2013-11-01', '2014-01-21',\n",
       "               '2014-04-02', '2014-05-28', '2014-07-04', '2014-09-05',\n",
       "               '2014-10-31', '2015-03-17', '2015-05-25', '2015-06-08',\n",
       "               '2015-09-22', '2015-12-04', '2015-12-17', '2016-03-04',\n",
       "               '2016-04-15', '2016-05-31', '2016-07-01', '2016-08-09',\n",
       "               '2016-11-01', '2017-01-18', '2017-03-24', '2017-04-26',\n",
       "               '2017-08-22', '2017-10-12', '2017-12-08', '2017-12-21',\n",
       "               '2018-01-12', '2018-03-19', '2018-06-06', '2018-07-24',\n",
       "               '2018-08-09', '2018-08-24', '2018-10-22', '2018-11-06',\n",
       "               '2018-11-19', '2019-01-21', '2019-06-13', '2019-08-21',\n",
       "               '2019-10-14', '2019-11-05', '2019-12-19', '2020-01-02'],\n",
       "              dtype='datetime64[ns]', name='date', freq=None)"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#不用循环的写法\n",
    "sr1 = df['ma5'] >= df['ma30']\n",
    "sr2 = df['ma5'] < df['ma30']\n",
    "\n",
    "golden_cross = df[sr1 & sr2.shift(1)].index \n",
    "death_cross = df[~(sr1 | sr2.shift(1))].index \n",
    "golden_cross"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "505235.29999999976"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#双均线策略的收益计算  从2010-01-01开始计算  初始资金100000\n",
    "money = 100000\n",
    "hold = 0\n",
    "sr1 = pd.Series(1,index=golden_cross)\n",
    "sr2 = pd.Series(0,index=death_cross)\n",
    "sr = sr1.append(sr2).sort_index()\n",
    "\n",
    "for i in range(0,len(sr)):\n",
    "    price = df['open'][sr.index[i]]\n",
    "    if sr.iloc[i] == 1:\n",
    "        #金叉买入\n",
    "        hold = (money // (price*100)) * 100\n",
    "        money -= hold*price\n",
    "    else:\n",
    "        money += hold*price\n",
    "        hold = 0\n",
    "latest_price =  df['open'][-1]\n",
    "all_money = money + hold*latest_price\n",
    "all_money"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
